package com.bsoft.config.interceptorConf;

import com.bsoft.interceptor.ServletInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**拦截器   Lookup method resolution failed*/
@Component
//@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    ServletInterceptor servletInterceptor;

    /**拦截规则指的是当前访问的接口需不需要进入ServletInterceptor这个类进行一些其他的特殊处理
     * 例如 : 登录  大部分接口不需要每次做权限校验  只有少部分路径需要 进行拦截处理
     * */
    //.excludePathPatterns("/**/BaseController/getValue2/*","/**/error").excludePathPatterns("/error")
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(servletInterceptor).addPathPatterns("/**").excludePathPatterns("/**/registerController/getBrdaList");

        //WebMvcConfigurer.super.addInterceptors(registry);
    }
}
